# -*- coding:utf-8 -*-
# @FileName  :getinfo.py
# @Time      :2022/12/20 21:55
# @Author    :凉柠
# @E-main    :1075090027@qq.com
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework.permissions import IsAuthenticated
from game.models.player.player import Player

class InfoView(APIView):
    permission_classes = ([IsAuthenticated])

    def get(self,request):
        user = request.user
        player = Player.objects.get(user=user)
        return Response({
            'result':"success",
            'username':user.username,
            'photo':player.photo
        })